package com.yang.frost.raspberry.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.Objects;

/**
 * @author 10296
 * @date 2020/12/24
 * @Description: 获取当前请求的HttpServletRequest对象
 */

public class HttpServletRequestUtil {

    public static HttpServletRequest getServletRequest() {
        return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
    }
}
